package com.ruoyi.web.controller.system;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.SysBrand;
import com.ruoyi.system.service.SysBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "品牌管理")
@RestController
@RequestMapping("/api")
public class SysBrandController extends BaseController {
    @Autowired
    SysBrandService service;
    @PostMapping("/list")
    @ApiOperation("品牌列表")
    public TableDataInfo queryAll( SysBrand brand){
        startPage();
        List<SysBrand> list=service.queryAll(brand);
        return getDataTable(list);
    }
    @ApiOperation("插入品牌")
    @PostMapping("/addBrand")
    public AjaxResult add(@RequestBody SysBrand brand){
        return service.add(brand)>0?success("插入成功"):error("插入失败");
    }
}
